#include "maploaddialog.h"
#include "../include/ui_maploaddialog.h"
#include <QFileDialog>

MapLoadDialog::MapLoadDialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::MapLoadDialog)
{
    ui->setupUi(this);
    setWindowTitle("载入地图");
}

MapLoadDialog::~MapLoadDialog()
{
    delete ui;
}

QString MapLoadDialog::name() const
{
    return ui->NameEdit->text();
}

QString MapLoadDialog::path() const
{
    return ui->PathEdit->text();
}

QPointF MapLoadDialog::base() const
{
    return QPointF(ui->XEdit->text().toDouble(), ui->XEdit->text().toDouble());
}

QSizeF MapLoadDialog::size() const
{
    return QSizeF(ui->WEdit->text().toDouble(), ui->HEdit->text().toDouble());
}

bool MapLoadDialog::visible() const
{
    return ui->VisibleCheckBox->isChecked();
}

void MapLoadDialog::on_OpenBtn_clicked()
{
    QString path = QFileDialog::getOpenFileName(nullptr,
                                                "选择地图",
                                                ".",
                                                "Images (*.bmp);;All Files (*)");
    ui->PathEdit->setText(path);
}

